<html><head><title>Adapter.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>Adapter.js</h1><pre class="highlighted"><code><i>/**
 * @class Ext.menu.Adapter
 * @extends Ext.menu.BaseItem
 * A base utility class that adapts a non-menu component so that it can be wrapped by a menu item and added to a menu.
 * It provides basic rendering, activation management and enable/disable logic required to work <b>in</b> menus.
 * @constructor
 * Creates a <b>new</b> Adapter
 * @param {Ext.Component} component The component being adapted to render into a menu
 * @param {Object} config Configuration options
 */</i>
Ext.menu.Adapter = <b>function</b>(component, config){
    Ext.menu.Adapter.superclass.constructor.call(<b>this</b>, config);
    <b>this</b>.component = component;
};
Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {
    <i>// private</i>
    canActivate : true,

    <i>// private</i>
    onRender : <b>function</b>(container, position){
        <b>this</b>.component.render(container);
        <b>this</b>.el = <b>this</b>.component.getEl();
    },

    <i>// private</i>
    activate : <b>function</b>(){
        <b>if</b>(this.disabled){
            <b>return</b> false;
        }
        <b>this</b>.component.focus();
        <b>this</b>.fireEvent(&quot;activate&quot;, <b>this</b>);
        <b>return</b> true;
    },

    <i>// private</i>
    deactivate : <b>function</b>(){
        <b>this</b>.fireEvent(&quot;deactivate&quot;, <b>this</b>);
    },

    <i>// private</i>
    disable : <b>function</b>(){
        <b>this</b>.component.disable();
        Ext.menu.Adapter.superclass.disable.call(<b>this</b>);
    },

    <i>// private</i>
    enable : <b>function</b>(){
        <b>this</b>.component.enable();
        Ext.menu.Adapter.superclass.enable.call(<b>this</b>);
    }
});</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
    </body></html>